class RemoveColumnFlashShowUrlFromTools < ActiveRecord::Migration
  def self.up
  	add_column :tools, :flash_type, :string , :default => 'embed'
  	Tool.all.each do |tool|
      (tool.flash_show_url.blank? ? tool.embed_and_popup! : tool.popup!) if tool.flash? and Rails.env != 'test'
    end
    remove_column :tools, :flash_show_url
  end

  def self.down
    remove_column :tools, :flash_type
    add_column :tools, :flash_show_url, :string
  end
end
